{extend name="index_layout"/}
{block name="main"}
<div class="layui-card">
    <div class="layui-card-header">客源列管理</div>
    <div class="layui-card-body">
        <div class="layui-form">
            <table class="layui-hide" id="currentTable" lay-filter="currentTable"
                   data-auth-add="{:$auth->check('source/add')}"
                   data-auth-edit="{:$auth->check('source/edit')}"
                   data-auth-delete="{:$auth->check('source/del')}"
                   data-auth-recyclebin="{:$auth->check('source/recyclebin')}"
            ></table>
        </div>
    </div>
</div>
{/block}
{block name="script"}
<script type="text/javascript">
    layui.use('yznTable', function () {
        var table = layui.yznTable;

        var init = {
            table_elem: '#currentTable',
            table_render_id: 'currentTable',
            add_url: '{:url("add")}',
            edit_url: '{:url("edit")}',
            delete_url: '{:url("del")}',
            modify_url: "{:url('multi')}",
            recyclebin_url: "{:url('recyclebin')}",
        };

        table.render({
            init: init,
            toolbar: ['refresh', 'delete', 'recyclebin'],
            url: '{:url("index")}',
            cols: [
                [
                    {type: 'checkbox', fixed: 'left'},
                    { field: 'weigh',align: 'center', width: 80, title: '排序', edit: 'text' },

                    {field: 'id', align: 'center', title: 'ID', minWidth: 80,search: false},
                    {field: 'member.nickname', align: 'center', title: '用户昵称', minWidth: 80},
                    {
                        field: 'company_name',
                        align: 'center',
                        title: '公司名称',
                        searchOp: 'LIKE',
                        minWidth: 130
                    },
                    {field: 'phone', align: 'center', title: '联系电话', searchOp: 'LIKE', minWidth: 130},
                    {
                        field: 'status',
                        align: 'center',
                        width: 120,
                        title: '状态',
                        unresize: true,
                        templet: yznTable.formatter.switch,
                        tips: "显示|隐藏",
                        selectList: {0: '冻结', 1: '正常'},
                    },
                    // {field: 'weigh', title: '排序', minWidth: 80, search: false},
                    {
                        field: 'create_time',
                        title: '创建时间',

                        minWidth: 80,
                        width: 180,
                        search: false,
                        templet: yznTable.formatter.datetime
                    },
                    {
                        field: 'update_time',
                        title: '更新时间',
                        minWidth: 80,
                        width: 180,
                        search: false,
                        templet: yznTable.formatter.datetime
                    },
                    {
                        fixed: 'right',
                        width: 90,
                        field: 'operate',
                        title: '操作',
                        search: false,
                        templet: yznTable.formatter.tool,
                        operat: ['edit', 'delete']
                    }
                ]
            ],
            page: {}
        });

        yznTable.bindevent();
    });
</script>
{/block}